﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Security;
using NK.Mvc3.Models;

namespace NK.Mvc3.DBL
{
    public class StoreInitializer: DropCreateDatabaseIfModelChanges<StoreContext>
    {
        protected override void Seed(StoreContext context)
        {
            var products = new List<ProductInfo>
                               {
                                   new ProductInfo
                                       {
                                           Group = "TB4",
                                           GroupCode = "0004",
                                           BarCode = "9311755208230"
                                           ,
                                           ProductName = "XÚC XÍCH HEO 20GR",
                                           POSDescription = "XX HEO 20GR",
                                           PKT = "20GR/Bar",
                                           Cost = 1727,
                                           VAT = 0.1,
                                           CostIncludeVAT = 1900,
                                           PriceA = 3000,
                                           PriceB = 3000,
                                           PriceC = 3000,
                                           PriceD = 3000
                                       },
                                       new ProductInfo
                                       {
                                           Group = "NF6",
                                           GroupCode = "0006",
                                           BarCode = "8938502223066"
                                           ,
                                           ProductName = "NANO STERILISED WET TISSUES ( KHĂN ƯỚT NANO 01 MIẾNG/BAO, 10 BAO/GÓI)",
                                           POSDescription = "KUOT NANO",
                                           PKT = "10 BAO/GÓI",
                                           Cost = 7725,
                                           VAT = 0.1,
                                           CostIncludeVAT = 8498,
                                           PriceA = 12000,
                                           PriceB = 11000,
                                           PriceC = 11000,
                                           PriceD = 10000
                                       }
                               };
            products.ForEach(p => context.ProductInfos.Add(p));
            context.SaveChanges();

        }
    }
}